# -*- coding: utf-8 -*-
# @Time    : 2021/8/30 11:47
# @Author  : BrandonGT
import sys
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *

class Label(QLabel):
    def keyPressEvent(self, evt):
        if evt.key() == Qt.Key_0:
            print("0 Has Pressed")
        elif evt.modifiers() == Qt.ControlModifier | Qt.ShiftModifier and evt.key() == Qt.Key_A:
            print("CTRL + SHIFT + A")

class Window(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("测试")
        self.resize(500, 500)
        self.setup_ui()

    def setup_ui(self):
        pass

    # def showEvent(self, QShowEvent):
    #     print("window open")
    #
    # def closeEvent(self, QCloseEvent):
    #     print("window close")
    #
    # def moveEvent(self, QMoveEvent):
    #     print("window moved")
    #
    # def resizeEvent(self, QResizeEvent):
    #     print("window size changed")
    #
    # def enterEvent(self, QEvent):
    #     print("mouse entered")
    #
    # def leaveEvent(self, QEvent):
    #     print("mouse leaved")
    #
    # def mousePressEvent(self, QMouseEvent):
    #     print("mouse pressed")
    #
    # def mouseReleaseEvent(self, QMouseEvent):
    #     print("mouse released")
    #
    # def mouseMoveEvent(self, QMouseEvent):
    #     print("mouse moved")
    #
    # def keyPressEvent(self, QKeyEvent):
    #     print("key pressed")
    #
    # def keyReleaseEvent(self, QKeyEvent):
    #     print("key released")
    #
    # def focusInEvent(self, QFocusEvent):
    #     print("focus in")
    #
    # def focusOutEvent(self, QFocusEvent):
    #     print("focus out")

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = Window()
    label = Label(window)
    label.resize(100, 100)
    label.setText("test")
    label.grabKeyboard()

    window.show()
    sys.exit(app.exec_())
